<!DOCTYPE html>
<!--[if IE 9]>         <html class="no-js lt-ie10" lang="en"> <![endif]-->
<!--[if gt IE 9]><!-->
<html class="no-js" lang="en">
	<!--<![endif]-->

	<head>
		<meta charset="utf-8">

		<title>问道——问卷调查系统</title>

		<meta name="description" content="AppUI is a Web App Bootstrap Admin Template created by pixelcave and published on Themeforest">
		<meta name="author" content="pixelcave">
		<meta name="robots" content="noindex, nofollow">

		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

		<!-- Icons -->
		<!-- The following icons can be replaced with your own, they are used by desktop and mobile browsers -->
		<link rel="shortcut icon" href="img/favicon.png">
		<link rel="apple-touch-icon" href="img/icon57.png" sizes="57x57">
		<link rel="apple-touch-icon" href="img/icon72.png" sizes="72x72">
		<link rel="apple-touch-icon" href="img/icon76.png" sizes="76x76">
		<link rel="apple-touch-icon" href="img/icon114.png" sizes="114x114">
		<link rel="apple-touch-icon" href="img/icon120.png" sizes="120x120">
		<link rel="apple-touch-icon" href="img/icon144.png" sizes="144x144">
		<link rel="apple-touch-icon" href="img/icon152.png" sizes="152x1upload
			52">
		<link rel="apple-touch-icon" href="img/icon180.png" sizes="180x180">
		<link rel="stylesheet" href="css/page.css" />
		<link rel="stylesheet" href="css/easy-upload.css">
		<link  >
		<!-- END Icons -->

		<!-- Stylesheets -->
		<!-- Bootstrap is included in its original form, unaltered -->
		<link rel="stylesheet" href="css/bootstrap.min.css">

		<!-- Related styles of various icon packs and plugins -->
		<link rel="stylesheet" href="css/plugins.css">
		<link rel="stylesheet" href="css/page.css" />

		<!-- The main stylesheet of this template. All Bootstrap overwrites are defined in here -->
		<link rel="stylesheet" href="css/main.css">
		<link  href="css/laypage.css" />
		<!-- Include a specific file here from css/themes/ folder to alter the default theme of the template -->

		<!-- The themes stylesheet of this template (for using specific theme color in individual elements - must included last) -->
		<link rel="stylesheet" href="css/themes/amethyst.css">
		<link rel="stylesheet" href="css/laypage.css">
		
    	
		<!-- END Stylesheets -->

		<!-- Modernizr (browser feature detection library) -->
		<script src="js/vendor/modernizr-3.3.1.min.js"></script>
		<script src="js/jquery-3.3.1.min.js"></script>
   		<script src="js/easyUpload.js"></script>
		 
	</head>

	<body>
		<!-- Page Wrapper -->
		<!-- In the PHP version you can set the following options from inc/config file -->
		<!--
            Available classes:

            'page-loading'      enables page preloader
        -->
		<div id="page-wrapper" class="page-loading">
			<!-- Preloader -->
			<!-- Preloader functionality (initialized in js/app.js) - pageLoading() -->
			<!-- Used only if page preloader enabled from inc/config (PHP version) or the class 'page-loading' is added in #page-wrapper element (HTML version) -->
			<div class="preloader">
				<div class="inner">
					<!-- Animation spinner for all modern browsers -->
					<div class="preloader-spinner themed-background hidden-lt-ie10"></div>

					<!-- Text for IE9 -->
					<h3 class="text-primary visible-lt-ie10"><strong>Loading..</strong></h3>
				</div>
			</div>
			<!-- END Preloader -->

			<!-- Page Container -->
			<!-- In the PHP version you can set the following options from inc/config file -->
			<!--
                Available #page-container classes:

                'sidebar-light'                                 for a light main sidebar (You can add it along with any other class)

                'sidebar-visible-lg-mini'                       main sidebar condensed - Mini Navigation (> 991px)
                'sidebar-visible-lg-full'                       main sidebar full - Full Navigation (> 991px)

                'sidebar-alt-visible-lg'                        alternative sidebar visible by default (> 991px) (You can add it along with any other class)

                'header-fixed-top'                              has to be added only if the class 'navbar-fixed-top' was added on header.navbar
                'header-fixed-bottom'                           has to be added only if the class 'navbar-fixed-bottom' was added on header.navbar

                'fixed-width'                                   for a fixed width layout (can only be used with a static header/main sidebar layout)

                'enable-cookies'                                enables cookies for remembering active color theme when changed fe sidebar links (You can add it along with any other class)
            -->
			<div id="page-container" class="header-fixed-top sidebar-visible-lg-full sidebar-light">
				<!-- Alternative Sidebar -->
				<div id="sidebar-alt" tabindex="-1" aria-hidden="true">
					<!-- Toggle Alternative Sidebar Button (visible only in static layout) -->
					<a href="javascript:void(0)" id="sidebar-alt-close" onclick="App.sidebar('toggle-sidebar-alt');"><i class="fa fa-times"></i></a>
				</div>
				<!-- END Alternative Sidebar -->

				<!-- Main Sidebar -->
				<div id="sidebar">
					<!-- Sidebar Brand -->
					<div id="sidebar-brand" class="themed-background">
						<a class="sidebar-title">
							<i class="fa fa-cube"></i> <span class="sidebar-nav-mini-hide"><strong>问道</strong></span>
						</a>
					</div>
					<!-- END Sidebar Brand -->

					<!-- Wrapper for scrolling functionality -->
					<div id="sidebar-scroll">
						<!-- Sidebar Content -->
						<div class="sidebar-content">
							<!-- Sidebar Navigation -->
							<ul class="sidebar-nav">
								<li class="active">
									<a href="questionnaire.html"><i class="gi gi-compass sidebar-nav-icon"></i><span class="sidebar-nav-mini-hide">问卷</span></a>
								</li>
								<li>
									<a href="survey.html"><i class="fa fa-rocket sidebar-nav-icon"></i><span class="sidebar-nav-mini-hide">调查</span></a>
								</li>
								<li>
									<a href="sendmsg.html"><i class="gi gi-compass sidebar-nav-icon"></i><span class="sidebar-nav-mini-hide">通知池</span></a>
								</li>
							</ul>
							<!-- END Sidebar Navigation -->
						</div>
						<!-- END Sidebar Content -->
					</div>
					<!-- END Wrapper for scrolling functionality -->
					<div style="position: absolute; bottom: 4%;margin: 0 4%;">
						<a href="localhost:80ghc/organize/login.html" style="text-decoration: underline;color: gray;">人员管理系统</a>
						<a href="#modal-info" data-toggle="modal"  style="color: gray;text-decoration: underline;">联系我们</a>
					
					</div>
				</div>
				<!-- END Main Sidebar -->

				<!-- Main Container -->
				<div id="main-container">
					<!-- Header -->
					<!-- In the PHP version you can set the following options from inc/config file -->
					<!--
                        Available header.navbar classes:

                        'navbar-default'            for the default light header
                        'navbar-inverse'            for an alternative dark header

                        'navbar-fixed-top'          for a top fixed header (fixed main sidebar with scroll will be auto initialized, functionality can be found in js/app.js - handleSidebar())
                            'header-fixed-top'      has to be added on #page-container only if the class 'navbar-fixed-top' was added

                        'navbar-fixed-bottom'       for a bottom fixed header (fixed main sidebar with scroll will be auto initialized, functionality can be found in js/app.js - handleSidebar()))
                            'header-fixed-bottom'   has to be added on #page-container only if the class 'navbar-fixed-bottom' was added
                    -->
					<header class="navbar navbar-inverse navbar-fixed-top">
						<!-- Left Header Navigation -->
						<ul class="nav navbar-nav-custom">
							<!-- Main Sidebar Toggle Button -->
							<li>
								<a href="javascript:void(0)" onclick="App.sidebar('toggle-sidebar');this.blur();">
									<i class="fa fa-ellipsis-v fa-fw animation-fadeInRight" id="sidebar-toggle-mini"></i>
									<i class="fa fa-bars fa-fw animation-fadeInRight" id="sidebar-toggle-full"></i>
								</a>
							</li>
							<!-- END Main Sidebar Toggle Button -->

							<!-- Header Link -->
							<li class="hidden-xs animation-fadeInQuick">
								<a href=""><strong>我的问卷</strong></a>
							</li>
							<!-- END Header Link -->
						</ul>
						<!-- END Left Header Navigation -->

						<!-- Right Header Navigation -->
						<ul class="nav navbar-nav-custom pull-right">
							<!-- User Dropdown -->
							<li class="dropdown">
								<span> </span>
								<a onclick="logout()" class="dropdown-toggle" data-toggle="dropdown">
									注销
								</a>
							</li>
							<!-- END User Dropdown -->
						</ul>
						<!-- END Right Header Navigation -->
					</header>
					<!-- END Header -->
					
					<!-- Page content -->
					<div id="page-content">
						<!-- Datatables Block -->
						<!-- Datatables is initialized in js/pages/uiTables.js -->
							<!--<div class="block-title">-->
							
							<!--</div>-->
							<div class="content-header"  >
							<div class="row" style="color: darkgray">
								<div class="col-sm-6">
									<div class="header-section">
									<button onclick="openmodal()" class="btn btn-effect-ripple btn-primary" data-toggle="modal" style="margin-left: 2%;margin-top: 1%;">上传问卷</button>
									</div>
								</div>
								<div class="col-sm-3 col-sm-offset-3 hidden-xs">
									<div class="header-section">
										<div class="input-group">
											<input type="text" id="input-search-survey" name="example-input1-group2" class="form-control" placeholder="搜   索" style="text-align: center;">
											<span class="input-group-btn">
                                                <button type="button" class="btn btn-effect-ripple btn-primary" onclick="search()"><i class="fa fa-search"></i></button>
                                            </span>
										</div>
									</div>
								</div>
							</div>
						</div>
						<div class="block full">
							<div class="table-responsive"style="background: rgba(253,253,253,.75);">
									<div class="block full" style="width: 80%;text-align: center;margin:2% 7%;">
										 <div class="row">
										 	 <div id="form">
										 	 	 <div class="panel panel-green margin-bottom-40">
										 	 	 	<div class="panel-heading">
										 	 	 	</div>
										 	 	 	<div class="panel-body">
										 	 	 		 <div 
										 	 	 		 	<div>
										 	 	 		 		
										 	 	 		 		<table class="table table-bordered table-striped">
										 	 	 		 			 <thead style="text-align: center;">
										 	 	 		 			 	 <tr>
										 	 	 		 			 	 	<th style="height: 40%; text-align: center; font-size: 2rem;">编号</th>
										 	 	 		 			 	 	<th style="width: 30%; height: 40%; text-align: center;font-size: 2rem;">问卷名称</th>
										 	 	 		 			 	 	<th style="height: 40%; width: 50%;text-align: center;font-size: 2rem;">操作</th>
										 	 	 		 			 	 </tr>
										 	 	 		 			 </thead>
										 	 	 		 			 <tbody id="tab_list"  class="table table-bordered table-striped"></tbody>
										 	 	 		 		
										 	 	 		 		</table>
										 	 	 		 	</div>
										 	 	 		 </div> 
										 	 	 	</div> 	
												</div>
										 	 </div>	
										 	 <div id="note"style="color: darkgray; " class="hidden">当前还未新建问卷</div>
										</div >
										<div id="layui" style="font-size: 2 rem;padding: 0 0 4% 0;"></div>
									</div>
									<!-- delete Modal -->
									<div id="modal-delete" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
										<div class="modal-dialog">
											<div class="modal-content">
												<div class="modal-header">
													<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
													<h3 class="modal-title"><strong>提示</strong></h3>
												</div>
												<div class="modal-body">
													是否删除该问卷？
												</div>
												<div class="modal-footer">
													<button type="button" class="btn btn-effect-ripple btn-primary" onclick="deleteQues()">确定</button>
													<button type="button" class="btn btn-effect-ripple btn-danger" data-dismiss="modal">取消</button>
												</div>
											</div>
										</div>
									</div>
									<!-- END delete Modal -->
									
									<!-- update Modal -->
									<div id="modal-update" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
										<div class="modal-dialog">
											<div class="modal-content">
												<div class="modal-header">
													<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
													<h3 class="modal-title"><strong>提示</strong></h3>
												</div>
												<div class="modal-body">
													是否更新该问卷？
												</div>
												<div class="modal-footer">
													<button type="button" class="btn btn-effect-ripple btn-primary">确定</button>
													<button type="button" class="btn btn-effect-ripple btn-danger" data-dismiss="modal">取消</button>
												</div>
											</div>
										</div>
									</div>
									<!-- END update Modal -->
									
									<!-- upload Modal -->
									<div id="modal-upload" class="modal" tabindex="-1" role="dialog" aria-hidden="true" backdrop:"static" >
										<div class="modal-dialog" aria-hidden="false" data-backdrop:"static" style="height: auto;" >
											<div class="modal-content">
												<div class="modal-header">
													<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
													<h3 class="modal-title"><strong>上传问卷</strong></h3>
												</div>
												<div class="modal-body">
													
													<div id="easyContainer" ></div>
													
												</div>
												<div class="modal-footer">
													 
													<button   type="button" id="quclose" name="" class="btn btn-effect-ripple btn-danger" data-dismiss="modal">确定</button>
													
												</div >
												
											</div>
										</div>
									</div>
									<!-- END upload Modal -->
									<!-- chgTitle Modal -->
									<div id="modal-chgTitle" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
										<div class="modal-dialog">
											<div class="modal-content">
											<div class="modal-header">
											<!--<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>-->
											<h3 class="modal-title">请输入新的问卷名称</h3>
											</div>
											<div class="modal-body">
												<!--<h4>请输入新的问卷名称</h3>-->
												<input type="text" name="newTitle" id="newTitle2" value="" class="form-control"/>
												<div id='quesnote2' style='margin-left:1%;margin-top:2%;color:red'></div>
											</div>
											<div class="modal-footer">
												<button type="button" onclick="submit()" class="btn btn-effect-ripple btn-primary">确定</button>
												<button type="button"  class="btn btn-effect-ripple btn-danger" data-dismiss="modal">取消</button>
											</div>
										</div>
									</div>
								</div>
								<div id="modal-info" class="modal" tabindex="-1" role="dialog" aria-hidden="true" style="z-index: 2000;">
									<div class="modal-dialog">
										<div class="modal-content">
										<div class="modal-header">
										<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
										<h3 class="modal-title"><strong>维护人员信息：</strong></h3>
									</div>
									<div class="modal-body">
										<p>手机号：18758263422（543422）</p>
										<p>微 信：F_10086_</p>
										<p>Q Q ：1390415732</p>
									</div>
									<div class="modal-footer">
										<button type="button" class="btn btn-effect-ripple btn-primary" data-dismiss="modal">确定</button>
									</div>
								</div>
							</div>
						</div>
								
							</div>
						</div>
						<!-- END Datatables Block -->
					</div>
					<!-- END Page Content -->

				</div>
				<!-- END Main Container -->
			</div>
			<!-- END Page Container -->
		</div>
		<!-- END Page Wrapper -->

		<!-- jQuery, Bootstrap, jQuery plugins and Custom JS code -->
		<script src="js/vendor/bootstrap.min.js"></script>
		<script src="js/plugins.js"></script>
		<script src="js/app.js"></script>
		<script src="js/lay/modules/laypage.js"></script>
		<!-- Load and execute javascript code used only in this page -->
		<script src="js/pages/uiTables.js"></script>
		<script src="js/package/jquery.dataTables.min.js"></script>
		<script src="js/layui.js"></script>
		<script src="js/layui.all.js"></script>
		
		<script type="text/javascript">
			//表格初始化
			var title,
				ip ;
			getUrl = '/list';
			var configJson='js/confing.json'
			$.getJSON(configJson,function(data){
				ip=data.urlip;
			});
			$(function() {
				identi();
				UiTables.init();
				getList();
				upload();
				$('body').on('hidden.bs.modal', '.modal', function () {
					console.log("dddd")
   					$(":input").val('');
   					$('.easy_upload_delbtn').click()
				});
			});
			//判断是否登录
			function identi()
			{
				$.ajax({
     				type: "get",
   					url: ip+"/user/type",
  					data:{
  						
  					},
    				async: true,
    				dataType: "json",
     				xhrFields: {withCredentials: true},
    				crossDomain:true,
    				success: function(res) {
    					console.log("sssss")
    					console.log(res)
						if(res.code==-1)
						{
							 window.location.replace("login.html")
							 window.history.forward(1);
						}
    				},
    				async:false
     			});
			}
			//url
		 
			
			function openmodal(){
			 $("#modal-upload").modal("toggle");
			}
			 
			function logout(){
			$.ajax({
					type:"get",
					url:ip+"/logout",
					data:{},
					async:true,
					dataType: "json",
					xhrFields: {withCredentials: true},
      				crossDomain:true,
      				success:function(res)
      				{
      					 if(!res.code){
      					 	window.location.replace("login.html")
      					 	window.history.forward(1);
      					 }
      				}
				});	
			}
			
			var total;
			//获取表格数据
			function getList(pageconf) {
				if(!pageconf){
					pageconf={};
					pageconf.pageSize=6;
					pageconf.currentPage=1;
				}
				$.ajax({
					type: "get",
					url: ip + getUrl,
					data: {
						"page":pageconf.currentPage,
						"size":pageconf.pageSize,
						
					},
					dataType: "json",
					xhrFields: {
						withCredentials: true
					},
					crossDomain: true,
					success: function(res) {
						console.log(res.data);
						//填充
						//setTable(res.data.content);
						if(res.data){
							total=res.data.total;
							getPage(pageconf,res.data.datas)
							if(typeof res.data=="string"){
								
								$("#form").addClass("hidden")
								$("#note").removeClass("hidden")
								$("#layui").addClass("hidden")
							}else{
								
							}
						}
					},
					async: true
				});
			}
			
			
			function getPage(pageconf,date){
				layui.use(['laypage','layer'],function(){
					var laypage=layui.laypage;
						
					laypage.render({
						elem:'layui',
						count:total,
						skin:'#7c62ad',
						curr:pageconf.currentPage,
						limit:pageconf.pageSize,
						limits:[6,12,18,24],
						skip:true,
						first:"首页",
						last:"尾页",
						layout:['count','skip', 'next', 'prev'],
						jump:function(obj,first){
							page=obj.curr;
							limit=obj.limit;
							if(!first){
								 pageconf.currentPage=obj.curr;
								 pageconf.pageSize=obj.limit;
								 getList(pageconf);
							}
						}
						 
						
					});
					fillTable(date,(pageconf.currentPage-1)*pageconf.pageSize);
					
				});
			}
			
			function fillTable(date,num){
				var info='';
				$.each(date, function(index,obj) {
					index=index+num+1;
					if(obj.used==true){
					info += "<tr class='column'><td>" + index + "</td><td class='column'>" + obj.name + "</td><td class='column'>" +"<button  class='btn btn-effect-ripple btn-info ml-2' id='btn-detail' name='" + obj.id + "' onclick='checkDetail(this.name)'>详情</button><a href='#modal-chgTitle'  class='btn btn-effect-ripple btn-primary ml-2 ' id='btn-edit' name='" + obj.id +"' onclick='getId(this.name)' data-toggle='modal'>编辑</a><button class='btn btn-effect-ripple btn-primary ml-2' id='btn-create' name='"+obj.id +"' onclick='createSurvey(this.name)'>新建调查</button><a class='btn btn-effect-ripple btn-danger ml-2  '  disabled>删除</a><a class='btn btn-effect-ripple btn-warning ml-2 hidden' disabled>更新</a>"+ "</td>" 
					
					}else{
					info += "<tr class='column'><td>" + index + "</td><td class='column'>" + obj.name + "</td><td>" +"<button class='btn btn-effect-ripple btn-info ml-2' id='btn-detail' name='" + obj.id + "' onclick='checkDetail(this.name)'>详情</button><a href='#modal-chgTitle' class='btn btn-effect-ripple btn-primary ml-2' id='btn-edit' name='" + obj.id +"' onclick='getId(this.name)'  data-toggle='modal'>编辑</a><button class='btn btn-effect-ripple btn-primary ml-2' id='btn-create' name='"+obj.id +"' onclick='createSurvey(this.name)'>新建调查</button><a href='#modal-delete' class='btn btn-effect-ripple btn-danger ml-2' onclick='trasnId(this.name)' name='" + obj.id + "' data-toggle='modal'>删除</a><a href='#modal-update' class='btn btn-effect-ripple btn-warning ml-2 hidden' data-toggle='modal'>更新</a>"+ "</td>" 	
					}
					});
				$("#tab_list").html(info);
			}
			

			function checkDetail(that) {
				console.log(that);
				var url = 'checkQuestionnaire.html?id=' + that;
				window.open(url, "_blank");
			}
			
			function return_ques(){
				$("#modal-info").modal("toggle")
			}
			
			function createSurvey(that) {
				var url = 'createSurvey.html?id=' + that;
				window.open(url, "_blank");
			}
			
			/* 删除问卷 */
			var deleteId='',
				deleteUrl='/delete'
			
			function trasnId(id)  {
				console.log(id);
				deleteId=id;
			}
			
			var editId="";
			
			function getId(id){
				console.log(id);
				editId=id;
				$("#newTitle2").val("")
			}
			function deleteQues() {
				$.ajax({
					type:"delete",
					url: ip+deleteUrl+'?id='+deleteId,
					//dataType: "json",
					xhrFields: {
						withCredentials: true
					},
					crossDomain: true,
					success: function(res) {
						console.log(res);
						$(".layui-laypage-btn").click();
						$("#modal-delete").modal("toggle");
					},
					async:true
				});
			}
			
		var loadUrl='/excel';	
		//上传问卷================================================================================
	function upload(){
	  $('#easyContainer').easyUpload({
      allowFileTypes: '*.xls;*.xlsx',
      allowFileSize: 100000,//允许上传文件大小(KB)
      selectText: '选择文件',//选择文件按钮文案
      multi: false,//是否允许多文件上传
      multiNum: 1,//多文件上传时允许的文件数
      showNote: true,//是否展示文件上传说明
      note: '提示：一份问卷只能绑定一份表格，支持格式为xls,xlsx',//文件上传说明
      showPreview: true,//是否显示文件预览
      url:ip+loadUrl,//上传文件地址
      method: "post",
      fileName: 'file',//文件filename配置参数
      formParam: {
       //"name":$("#newTitle").val()
      },//文件filename以外的配置参数，格式：{key1:value1,key2:value2}
      timeout: 30000,//请求超时时间
      okCode: 0,//与后端返回数据code值一致时执行成功回调，不配置默认200
      successFunc: function(res) {
      	if($("#layui").hasClass("hidden")){
      		$("#layui").removeClass("hidden")
      		$("#note").addClass("hidden")
      		$("#form").removeClass("hidden")
      	}
      	getList()
      	$(".layui-laypage-btn").click();
        console.log('成功回调', res);
      },//上传成功回调函数
      errorFunc: function(res) {
      	if($("#newTitlesh").val()=='')
      	{
      		 $("#quesnotesh").html("请输入新的问卷名称")
      	}
      	else{
      		if(typeof res.data=="string")
      		{
      			$("#quesnotesh").html(res.data)
      		}
      		
      	}
        console.log('失败回调', res);
      },//上传失败回调函数
      deleteFunc: function(res) {
        console.log('删除回调', res);
        $("#quesnotesh").html('')
        $("#newTitlesh").val('')
      }//删除文件回调函数
    });
	}	//=========================================================================================		
		
		
		
			function submit() {
				console.log($("#newTitle2").val())
				if(!$("#newTitle2").val()){
					 	$("#quesnote2").html("*输入名称不能为空")
				}
				else{
				$.ajax({
					type: "post",
					url: ip+"/excel/changeName",
					data: {
						id: editId,
						name: $("#newTitle2").val()
					},
					dataType: "json",
//					contentType: "application/json",
					xhrFields: {
						withCredentials: true
					},
					crossDomain: true,
					success: function(res) {
						console.log(res);
						if((!res.code)&&typeof res.data=="string")
						{
							 
							$("#quesnote2").html(res.data);
							
						}else{
							
							$(".layui-laypage-btn").click();
							$("#modal-chgTitle").modal("toggle")
						}
					},
					async: true
				});
				}
			}
			
			//搜索功能===========================================================
			 $('#input-search-survey').bind('input propertychange', function() {
    				searchCity();
  			});
			
			function searchCity(pageconf){
				if(!pageconf){
					pageconf={};
					pageconf.pageSize=6;
					pageconf.currentPage=1;
				}
				$.ajax({
					type: "get",
					url: ip + '/select',
					data: {
						"page":pageconf.currentPage,
						"size":pageconf.pageSize,
						 "word":$("#input-search-survey").val(),
					},
					dataType: "json",
					xhrFields: {
						withCredentials: true
					},
					crossDomain: true,
					success: function(res) {
						console.log(res.data);
						//填充
						//setTable(res.data.content);
						if(typeof res.data!="string"){
							total=res.data.total;
							getPage2(pageconf,res.data.datas)
							$("#form").removeClass("hidden")
							$("#note").addClass("hidden")
							$("#layui").removeClass("hidden")
						}else{
								$("#form").addClass("hidden")
								$("#note").removeClass("hidden")
								$("#layui").addClass("hidden")
						}
					},
					async: true
				});
			}
			
			function getPage2(pageconf,date){
				layui.use(['laypage','layer'],function(){
					var laypage=layui.laypage;
						
					laypage.render({
						elem:'layui',
						count:total,
						skin:'#7c62ad',
						curr:pageconf.currentPage,
						limit:pageconf.pageSize,
						limits:[6,12,18,24],
						skip:true,
						first:"首页",
						last:"尾页",
						layout:['count','skip', 'next', 'prev'],
						jump:function(obj,first){
							page=obj.curr;
							limit=obj.limit;
							if(!first){
								 pageconf.currentPage=obj.curr;
								 pageconf.pageSize=obj.limit;
								 searchCity(pageconf);
							}
						}
						
					});
					fillTable(date,(pageconf.currentPage-1)*pageconf.pageSize);
					
				});
			}
			
		</script>

	</body>

</html>